package ATM;

import java.io.Serializable;

public class Account implements Serializable
{
	private int accountNumber;
	private int pin;
	private double availableBalance;
	
	public Account(int theAccountNumber, int thePIN, double theAvailableBalance) //double theTotalBalance)
	{
		accountNumber = theAccountNumber;		// an Account consists of: Account Number, PIN and the Available Balance of the user
		pin = thePIN;
		availableBalance = theAvailableBalance;
	}
	
	public boolean validatePIN(int userPIN)
	{
		if(userPIN == pin)
			return true;
		else
			return false;
	}
	
	public double getAvailableBalance()
	{
		return availableBalance;		
	}
	
	public void credit(double amount)
	{
		availableBalance += amount;
	}
	
	public void debit(double amount)
	{
		availableBalance -= amount;
	}
	
	public int getAccountNumber()
	{
		return accountNumber;
	}
}